From: Richard M. Stallman Date: Fri, 25 Jun 1993 22:30:49 +0000 (+0000) Subject: (mouse-menu-bar-buffers): Include % and * in each item. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~95162 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=b9d07cf7118787c8f11b41884c7d60cecedd6643;p=emacs.git (mouse-menu-bar-buffers): Include % and * in each item. Calculate amount of space needed for longest buffer name. --- diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 0f174f1fab9..67df0d26185 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -160,8 +160,16 @@ and selects that window." (list "Buffer Menu" (cons "Select Buffer" (let ((tail buffers) + (maxbuf 0) (maxlen 0) head) + (while tail + (or (eq ?\ (aref (buffer-name (car tail)) 0)) + (setq maxbuf + (max maxbuf + (length (buffer-name (car tail)))))) + (setq tail (cdr tail))) + (setq tail buffers) (while tail (let ((elt (car tail))) (if (not (string-match "^ " @@ -169,8 +177,13 @@ and selects that window." (setq head (cons (cons (format - "%14s %s" + (format "%%%ds %%s%%s %%s" + maxbuf) (buffer-name elt) + (if (buffer-modified-p elt) "*" " ") + (save-excursion + (set-buffer elt) + (if buffer-read-only "%" " ")) (or (buffer-file-name elt) "")) elt) head)))